package com.up360.rapidcalc.scene
{
	import flash.utils.getDefinitionByName;
	
	import com.up360.rapidcalc.global.LayerManager;

	/**
	 * 作者:郎福涛
	 * 日期:2012-4-5 上午12:11:50
	 * 说明:
	 */	
	public class SceneManager
	{
		private static var _currentScene:BaseScene;
		
		public function SceneManager()
		{
		}
		
		/**
		 * 获取当前场景
		 */		
		public static function get currentScene():BaseScene{
			return _currentScene;
		}
		/**
		 * 切换场景
		 * @param sceneClass
		 * @param param
		 */		
		public static function changeScene(sceneClass:Class,param:Object=null):void{
			if(_currentScene) _currentScene.dispose();
			if(param==null){
				_currentScene=new sceneClass();
			}else{
				_currentScene=new sceneClass(param);
			}
		}
		/**
		 * 通过场景名切换场景
		 * @param name 场景名,比如PlayingScene
		 */		
		public static function changeSceneWithName(name:String):void{
			if(_currentScene) _currentScene.dispose();
			
			var b_sceneClass:Class=getDefinitionByName("com.up360.rapidcalc.scene."+name) as Class;
			_currentScene =new b_sceneClass();
			
		}
	}
}